#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "QPainter"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    w = new WhiteBoard();
    c = new CbackgroundWidget();

    connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(buttonAction()));
    connect(c, SIGNAL(changeBgColor()), this, SLOT(changeBgColor()));
    connect(c, SIGNAL(stopDraw()), this, SLOT(stopDraw()));
}

void MainWindow::changeBgColor() {
    w->w_changeBgColor(c->colorStr);
}

void MainWindow::stopDraw() {
    w->w_stopDraw();
}

void MainWindow::buttonAction() {
    this->close();
    w->showFullScreen();
    c->showFullScreen();
}

void MainWindow::closeToolWindow() {
    w->hide();
}

MainWindow::~MainWindow()
{
    delete ui;
}

